<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
      <title>Object Management Menu Button | HiAPI-C# 2025 </title>
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <meta name="title" content="Object Management Menu Button | HiAPI-C# 2025 ">
      
      
      <link rel="icon" href="../../../../img/HiAPI.favicon.ico">
      <link rel="stylesheet" href="../../../../public/docfx.min.css">
      <link rel="stylesheet" href="../../../../public/main.css">
      <meta name="docfx:navrel" content="../../../../toc.html">
      <meta name="docfx:tocrel" content="../../toc.html">
      
      <meta name="docfx:rel" content="../../../../">
      
      
      
      <meta name="loc:inThisArticle" content="In this article">
      <meta name="loc:searchResultsCount" content="{count} results for &quot;{query}&quot;">
      <meta name="loc:searchNoResults" content="No results for &quot;{query}&quot;">
      <meta name="loc:tocFilter" content="Filter by title">
      <meta name="loc:nextArticle" content="Next">
      <meta name="loc:prevArticle" content="Previous">
      <meta name="loc:themeLight" content="Light">
      <meta name="loc:themeDark" content="Dark">
      <meta name="loc:themeAuto" content="Auto">
      <meta name="loc:changeTheme" content="Change theme">
      <meta name="loc:copy" content="Copy">
      <meta name="loc:downloadPdf" content="Download PDF">

      <script type="module" src="./../../../../public/docfx.min.js"></script>

      <script>
        const theme = localStorage.getItem('theme') || 'auto'
        document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
      </script>

  </head>

  <body class="tex2jax_ignore" data-layout="" data-yaml-mime="">
    <header class="bg-body border-bottom">
      <nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
        <div class="container-xxl flex-nowrap">
          <a class="navbar-brand" href="../../../../index.html">
            <img id="logo" class="svg" src="../../../../img/HiAPI.logo.png" alt="">
            
          </a>
          <button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
            <i class="bi bi-three-dots"></i>
          </button>
          <div class="collapse navbar-collapse" id="navpanel">
            <div id="navbar">
              <form class="search" role="search" id="search">
                <i class="bi bi-search"></i>
                <input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
              </form>
            </div>
          </div>
        </div>
      </nav>
    </header>

    <main class="container-xxl">
      <div class="toc-offcanvas">
        <div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
          <div class="offcanvas-header">
            <h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
            <button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
          </div>
          <div class="offcanvas-body">
            <nav class="toc" id="toc"></nav>
          </div>
        </div>
      </div>

      <div class="content">
        <div class="actionbar">
          <button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
            <i class="bi bi-list"></i>
          </button>

          <nav id="breadcrumb"></nav>
        </div>

        <article data-uid="">
          <h1 id="object-management-menu-button">Object Management Menu Button</h1>

<p>The menu button represent the target object with getter function and setter function. The target object generally is <a class="xref" href="../../../../api/Hi.Common.XmlUtils.IMakeXmlSource.html">IMakeXmlSource</a>.</p>
<p>the target object with getter function and setter function is such like:</p>
<pre><code class="lang-csharp">object TargetObject{get=&gt;TargetObjectGetter?.Invoke();set=&gt;TargetObjectSetter?.Invoke(value);}
Func&lt;TargetObject&gt; TargetObjectGetter{get;set;}
Action&lt;TargetObject&gt; TargetObjectSetter{get;set;}
</code></pre>
<p>The target object has the following functions:</p>
<ul>
<li>File Save/Load
<ul>
<li>See <a href="gui-file-path-assignment.html">GUI File Path Assignment</a></li>
</ul>
</li>
<li>Object Copy/Paste</li>
<li>Editor Panel Mode Selection
<ul>
<li>GUI (user-friendly)</li>
<li>XML
<ul>
<li>Get XML by <a class="xref" href="../../../../api/Hi.Common.XmlUtils.IMakeXmlSource.html">IMakeXmlSource</a> with <code>exhibitionOnly</code> true.</li>
<li>Set XML by <a class="xref" href="../../../../api/Hi.Common.XmlUtils.XFactory.html">XFactory</a>.</li>
</ul>
</li>
</ul>
</li>
</ul>
<p>If the target object is not <a class="xref" href="../../../../api/Hi.Common.XmlUtils.IMakeXmlSource.html">IMakeXmlSource</a>, then the XML Editor Panel Mode should not appear. The other functions are still buildable.</p>
<p>Don't use <a class="xref" href="../../../../api/Hi.Common.XmlUtils.GenMode.html">GenMode</a>.<a class="xref" href="../../../../api/Hi.Common.XmlUtils.GenMode.html#Hi_Common_XmlUtils_GenMode_Default">Default</a> on <a class="xref" href="../../../../api/Hi.Common.XmlUtils.XFactory.html">XFactory</a> functions. Use <a class="xref" href="../../../../api/Hi.Common.XmlUtils.GenMode.html">GenMode</a>.<a class="xref" href="../../../../api/Hi.Common.XmlUtils.GenMode.html#Hi_Common_XmlUtils_GenMode_Rebase">Rebase</a>. Since <a class="xref" href="../../../../api/Hi.Common.XmlUtils.GenMode.html">GenMode</a>.Default pass the inner exception silently.</p>
<h2 id="layout">Layout</h2>
<ul>
<li>Object Management Menu Button
<ul>
<li>Load Button</li>
<li>Load Resource Button</li>
<li>Save As Button</li>
<li>(splitter)</li>
<li>Copy Button (with hotkey support if the Object Management Menu Button is focused)</li>
<li>Paste Button (with hotkey support if the Object Management Menu Button is focused)</li>
<li>(splitter)</li>
<li>GUI Ratio Button</li>
<li>XML Ratio Button</li>
</ul>
</li>
</ul>
<div class="TIP">
<h5>Tip</h5>
<ul>
<li>Since the Object Management Menu Button has special meaning, use icon instead of text label.</li>
<li>Do not use icon on the other child buttons. The icons gains nothing but hard to keep style to the full application.</li>
<li>If the model is selected, show a different style (may be color) on the menu button.</li>
<li>The model should contain a ResourceDirectory property.</li>
<li>Do not show Load Resource Button if Resource directory not explicitly gave.</li>
</ul>
</div>
<h2 id="copy--paste">Copy &amp; Paste</h2>
<ul>
<li>Object Copy/Paste (i.e. Select/Set or Duplicated-Set)
<ul>
<li>Copy (i.e. Select)
Set the model to AppService.SelectedItem.</li>
<li>Paste
Set AppService.SelectedItem to the model.
Set by reference is default. Apply Duplicated-Set if explicitly required.</li>
</ul>
</li>
</ul>
<p>While a object is copied (selected) here, it can also be paste (drag) to:</p>
<ul>
<li>Text editor
Use <a class="xref" href="../../../../api/Hi.Common.XmlUtils.IMakeXmlSource.html">IMakeXmlSource</a>.<a class="xref" href="../../../../api/Hi.Common.XmlUtils.IMakeXmlSource.html#Hi_Common_XmlUtils_IMakeXmlSource_MakeXmlSource_System_String_System_String_System_Boolean_">MakeXmlSource(string, string, bool)</a> with <code>exhibitionOnly</code> false and the argument (<code>baseDirectory</code> and <code>relFile</code>) from object's host to paste the text, it should be the same text content by the host XML output.</li>
<li>File browser
Use <a class="xref" href="../../../../api/Hi.Common.XmlUtils.IMakeXmlSource.html">IMakeXmlSource</a>.<a class="xref" href="../../../../api/Hi.Common.XmlUtils.IMakeXmlSource.html#Hi_Common_XmlUtils_IMakeXmlSource_MakeXmlSource_System_String_System_String_System_Boolean_">MakeXmlSource(string, string, bool)</a> with <code>exhibitionOnly</code> true, <code>baseDirectory</code> destination folder, <code>relFile</code> destination file name (maybe xxx.class-name) to paste the file.</li>
</ul>
<p>Show message when paste action success or failed. See <a href="../general-rules.html">Handle Message and Exception</a>.</p>
<p>If the data type is not matched, show the un-matched message.</p>
<h2 id="editor-panel-mode-ratio-button">Editor Panel Mode Ratio Button</h2>
<p>The Editor Panel switched by the Editor Panel Mode Ratio Button.</p>
<p>The BaseDirectory and RelFile properties should exist. Use the RelFile property if the object's host has the corresponding property like XXXFile.</p>
<p>The Apply action should be well-set. Include <a class="xref" href="../../../../api/Hi.Common.XmlUtils.SetFileDelegate.html">SetFileDelegate</a> from <a class="xref" href="../../../../api/Hi.Common.XmlUtils.XFactory.html">XFactory</a>.<a class="xref" href="../../../../api/Hi.Common.XmlUtils.XFactory.html#Hi_Common_XmlUtils_XFactory_Gen__1_System_Xml_Linq_XElement_System_String_Hi_Common_XmlUtils_SetFileDelegate_Hi_Common_XmlUtils_GenMode_System_Object___">Gen&lt;T&gt;(XElement, string, SetFileDelegate, GenMode, params object[])</a> function.
The last argument should also be delivered by the host. So there must exist an property to pass the argument.</p>
<h3 id="xml-editor-panel-layout">XML Editor Panel Layout</h3>
<ul>
<li>XML Editor Panel
<ul>
<li>Cancel Button</li>
<li>Apply Button</li>
<li>XML TextArea</li>
</ul>
</li>
</ul>
<p>Shows error message if the xml-parsing or object creation failed on XML Editor Panel Apply Button applied.</p>
<h2 id="wpf-application-source-code-path">WPF Application Source Code Path</h2>
<ul>
<li>Common/ObjectManagementMenuButton</li>
</ul>
<p>see <a href="../index.html">this page</a> for git repository.</p>

</article>

        <div class="contribution d-print-none">
        </div>

        <div class="next-article d-print-none border-top" id="nextArticle"></div>

      </div>

      <div class="affix">
        <nav id="affix"></nav>
      </div>
    </main>

    <div class="container-xxl search-results" id="search-results"></div>

    <footer class="border-top text-secondary">
      <div class="container-xxl">
        <div class="flex-fill">
          <span> Copyright © 2025 <a href='https://superhightech.com.tw'>Tech Coordinate</a>. All rights reserved. <a href='https://superhightech.com.tw'>超級高科技股份有限公司</a> © 2025 版權所有 </span>
        </div>
      </div>
    </footer>
  </body>
</html>
